package indi.kider.server.applandlord.service.related;

import indi.kider.common.model.apartment.DevLock;
import indi.kider.common.model.apartment.RentLock;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import pers.vankid.common.model.base.CommonResponse;
import pers.vankid.common.utils.page.PageRequest;

@FeignClient(value = "apartment")
public interface LockService {
    /**
     * @api {GET} /lockByHouseId/{houseId}
     * @apiGroup apartment
     * @apiDescription 根据房间ID查询锁信息
     * @apiParamExample 请求样例：
     * http://localhost:9002/apartment/devLock/lockByHouseId/1
     * @apiSuccessExample {json} 返回样例:
     * {
     * "status": "200",
     * "msg": "查询成功！",
     * "data":
     * {
     * "id": 1, --id
     * "houseId": 1,--房间id
     * "partnerCode": 'xx', -- 来源id(合作商id)
     * "name": 'xx',-- 姓名
     * "code": 'xx',-- 未说明
     * "imei":  'xx',-- imei
     * "cert":  'xx',-- 未说明
     * "regCode": 'xx',-- 未说明
     * "state": 2, -- 1:未安装;2:已绑定用户 99失效
     * "createDate": 'xx',-- 时间
     * "created": 1,--添加人ID
     * "createName": 'xx',--添加人姓名
     * }
     * }
     **/
    @GetMapping("devLock/lockByHouseId/{houseId}")
    CommonResponse <DevLock>lockByHouseId(@PathVariable (value = "houseId")Long houseId);

    /**
     * @api {PUT} /lock
     * @apiGroup apartment
     * @apiDescription 修改锁信息
     * @apiParamExample 请求样例：
     * http://localhost:9002/apartment/devLock/lock
     * {id:"","imei":null,"name":'锁具名称',"houseId":房间id}
     * @apiSuccessExample {json} 返回样例:
     * {status": "202","msg": "保存成功！","data": "" }
     */
    @PutMapping("devLock/lock")
    CommonResponse updateDevLock(@RequestBody DevLock devLock);
    /**
     * @api {POST} /lock
     * @apiGroup apartment
     * @apiDescription 新增锁具
     * @apiParamExample 请求样例：
     * http://localhost:9002/apartment/devLock/lock
     * {"imei":null,"name":'锁具名称',"houseId":房间id}
     * @apiSuccessExample {json} 返回样例:
     * {
     * "status": "201",
     * "msg": "保存成功！",
     * "data": 1
     * }
     */
    @PostMapping("devLock/lock")
    CommonResponse addDevLock(@RequestBody DevLock devLock) ;
    /**
     * @api {POST} /lock/list
     * @apiGroup apartment
     * @apiDescription 查询锁具列表
     * @apiParamExample 请求样例：
     * http://localhost:9002/apartment/devLock/lock/list
     *  {"num":"0","size":"8","query":{"name":'锁具名称',"expression":""}}
     * @apiSuccessExample {json} 返回样例:
     * {"status":"200","msg":"查询成功！","data":{"rows":[{"id":12,"houseId":null,"partnerCode":null,"name":"555","code":null,"imei":"55","cert":null,"regCode":null,"state":1,"createDate":null,"created":40,"wxopenId":null,"tenantName":"钱少","tenantTel":"15857565453","tenantId":201,"houseNumb":"woniu_1001","building":null,"unit":null,"address":"qs上城小区1号","community":"上城小区","communityId":null,"expression":null,"housesId":"269","enterpriseId":null}],"total":1,"size":1}}
     */
    @PostMapping("devLock/lock/list")
    CommonResponse getLockList(@RequestBody PageRequest<RentLock> request) ;
}
